<html>
    <head>
    <link rel="stylesheet" href="lmm.css" type="text/css" />
    </head>
<body class="lmm">
<!-- This file is part of the Lisp Machine Manual.  -*-Text-*- -->
<!-- Introduction: The Lisp Machine dialect, etc.   I.LISP -->
.page
	The rest of this chapter explains more of the details of the Lisp Machine
Lisp dialect.  This section is also suitable for the Maclisp user, as
it goes into detail about important differences between the dialects.
Those Maclisp users who have skipped the previous sections should definitely
read this one.

<div class='section' id='2.1'>2.1 Data Types</div>
	This section enumerates the various different types of objects
in Lisp Machine Lisp.  The types explained below include symbols, conses,
various types of numbers, two kinds of compiled code object, locatives,
arrays, stacks, and closures.  With each is given the associated
symbolic name, which is returned by the function <!-- open: 1, close: 0 --><font class="lisp">data-type</font><!-- open: 1, close: 1 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>data-type-fun)).
<p class='cindent'><!-- "data-type" -->
<p class='cindent'><!-- "symbol" -->
<p class='cindent'><!-- "print name" -->
<p class='cindent'><!-- "binding" -->
<p class='cindent'><!-- "definition" -->
<p class='cindent'><!-- "property list" -->

	A <!-- open: 2, close: 1 --><font class="italic">symbol</font><!-- open: 2, close: 2 --> <!-- MATCHED MATCHED MATCHED --> (these are sometimes called "atoms" or "atomic
symbols" by other texts) has a <!-- open: 3, close: 2 --><font class="italic">print name</font><!-- open: 3, close: 3 --> <!-- MATCHED MATCHED MATCHED -->, a <!-- open: 4, close: 3 --><font class="italic">binding</font><!-- open: 4, close: 4 --> <!-- MATCHED MATCHED MATCHED -->, a
<!-- open: 5, close: 4 --><font class="italic">definition</font><!-- open: 5, close: 5 --> <!-- MATCHED MATCHED MATCHED -->, a <!-- open: 6, close: 5 --><font class="italic">property list</font><!-- open: 6, close: 6 --> <!-- MATCHED MATCHED MATCHED -->, and a <!-- open: 7, close: 6 --><font class="italic">package</font><!-- open: 7, close: 7 --> <!-- MATCHED MATCHED MATCHED -->.

	The print name is a string, which may be obtained by the
function <!-- open: 8, close: 7 --><font class="lisp">get-pname</font><!-- open: 8, close: 8 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>get-pname-fun)).
This string serves as the <!-- open: 9, close: 8 --><font class="italic">printed representation</font><!-- open: 9, close: 9 --> <!-- MATCHED MATCHED MATCHED -->
(see <font color='red'>LINK:(</font>printer)) of the symbol.  The binding
(sometimes also called the "value") may be any object.  It is also
referred to sometimes as the "contents of the value cell", since
internally every symbol has a cell called the <!-- open: 10, close: 9 --><font class="italic">value cell</font><!-- open: 10, close: 10 --> <!-- MATCHED MATCHED MATCHED --> which
holds the binding.  It is accessed by the <!-- open: 11, close: 10 --><font class="lisp">symeval</font><!-- open: 11, close: 11 --> <!-- MATCHED MATCHED MATCHED -->
function (<font color='red'>LINK:(</font>symeval-fun)), and updated by the <!-- open: 12, close: 11 --><font class="lisp">set</font><!-- open: 12, close: 12 --> <!-- MATCHED MATCHED MATCHED --> function (<font color='red'>LINK:(</font>set-fun)).
(That is, given a
symbol, you use <!-- open: 13, close: 12 --><font class="lisp">symeval</font><!-- open: 13, close: 13 --> <!-- MATCHED MATCHED MATCHED --> to find out what its binding is,
and use <!-- open: 14, close: 13 --><font class="lisp">set</font><!-- open: 14, close: 14 --> <!-- MATCHED MATCHED MATCHED --> to change its binding.)  The definition may
also be any Lisp object.  It is also referred to as the "contents of
the function cell", since internally every symbol has a cell called
the <!-- open: 15, close: 14 --><font class="italic">function cell</font><!-- open: 15, close: 15 --> <!-- MATCHED MATCHED MATCHED --> which holds the definition.  The
definition can be accessed by the <!-- open: 16, close: 15 --><font class="lisp">fsymeval</font><!-- open: 16, close: 16 --> <!-- MATCHED MATCHED MATCHED --> function (<font color='red'>LINK:(</font>fsymeval-fun)), and updated
with <!-- open: 17, close: 16 --><font class="lisp">fset</font><!-- open: 17, close: 17 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>fset-fun)).  The property list is a list of an even number of
elements; it can be accessed directly by <!-- open: 18, close: 17 --><font class="lisp">plist</font><!-- open: 18, close: 18 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>plist-fun)), and updated
directly by <!-- open: 19, close: 18 --><font class="lisp">setplist</font><!-- open: 19, close: 19 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>setplist-fun)), although usually the functions <!-- open: 20, close: 19 --><font class="lisp">get</font><!-- open: 20, close: 20 --> <!-- MATCHED MATCHED MATCHED -->,
<!-- open: 21, close: 20 --><font class="lisp">putprop</font><!-- open: 21, close: 21 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 22, close: 21 --><font class="lisp">remprop</font><!-- open: 22, close: 22 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>get-fun)) are used.
The property list is used to associate any number
of additional attributes with a symbol--attributes not used frequently enough
to deserve their cells as the value and definition do.
Symbols also have a package cell, which indicates which "package" of names
the symbol belongs to.  This is explained further in the section on packages
and can be disregarded by the casual user.

	The primitive function for creating symbols is
<!-- open: 23, close: 22 --><font class="lisp">make-symbol</font><!-- open: 23, close: 23 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>make-symbol-fun))
(currently named <!-- open: 24, close: 23 --><font class="lisp">make-atom</font><!-- open: 24, close: 24 --> <!-- MATCHED MATCHED MATCHED -->), although most symbols
are created by <!-- open: 25, close: 24 --><font class="lisp">read</font><!-- open: 25, close: 25 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 26, close: 25 --><font class="lisp">intern</font><!-- open: 26, close: 26 --> <!-- MATCHED MATCHED MATCHED -->, or
<!-- open: 27, close: 26 --><font class="lisp">fasload</font><!-- open: 27, close: 27 --> <!-- MATCHED MATCHED MATCHED --> (who call <!-- open: 28, close: 27 --><font class="lisp">make-symbol</font><!-- open: 28, close: 28 --> <!-- MATCHED MATCHED MATCHED --> themselves.)

	A <!-- open: 29, close: 28 --><font class="italic">cons</font><!-- open: 29, close: 29 --> <!-- MATCHED MATCHED MATCHED --> is an object that cares about two
other objects, arbitrarily named the <!-- open: 30, close: 29 --><font class="italic">car</font><!-- open: 30, close: 30 --> <!-- MATCHED MATCHED MATCHED --> and the <!-- open: 31, close: 30 --><font class="italic">cdr</font><!-- open: 31, close: 31 --> <!-- MATCHED MATCHED MATCHED -->.
These objects can be accessed with <!-- open: 32, close: 31 --><font class="lisp">car</font><!-- open: 32, close: 32 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 33, close: 32 --><font class="lisp">cdr</font><!-- open: 33, close: 33 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>car-fun)), and updated
with <!-- open: 34, close: 33 --><font class="lisp">rplaca</font><!-- open: 34, close: 34 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 35, close: 34 --><font class="lisp">rplacd</font><!-- open: 35, close: 35 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>rplaca-fun)).  The primitive function for creating
conses is <!-- open: 36, close: 35 --><font class="lisp">cons</font><!-- open: 36, close: 36 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>cons-fun)).

	There are several kinds of numbers in Lisp Machine Lisp.
<!-- open: 37, close: 36 --><font class="italic">Fixnums</font><!-- open: 37, close: 37 --> <!-- MATCHED MATCHED MATCHED --> represent integers in the range of -2^23 to 2^23-1.
<!-- open: 38, close: 37 --><font class="italic">Bignums</font><!-- open: 38, close: 38 --> <!-- MATCHED MATCHED MATCHED --> represent integers of arbitrary size, with more overhead than fixnums.
The system automatically converts between fixnums and bignums as required.
<!-- open: 39, close: 38 --><font class="italic">Flonums</font><!-- open: 39, close: 39 --> <!-- MATCHED MATCHED MATCHED --> are floating-point numbers.  <!-- open: 40, close: 39 --><font class="italic">Small-flonums</font><!-- open: 40, close: 40 --> <!-- MATCHED MATCHED MATCHED --> are another
kind of floating-point numbers, with less range and precision, but less 
computational overhead.
Other types of numbers are likely to be added in the future.
See <a href='fd_num.html#number'>this link</a> for full details.

<p class='cindent'><!-- "fef" -->
	The usual form of compiled code is a Lisp object
called a "Function Entry Frame" or "FEF".  A FEF contains the code
for one function.  This is analogous to what Maclisp calls a "subr pointer".
FEFs are produced by the Lisp Compiler (<a href='compil.html#compiler'>this link</a>), and are usually found
as the definitions of symbols.  The printed representation of a FEF
includes its name, so that it can be identified.
	Another Lisp object which represents executable code is
a "micro-code entry".
These are the microcoded primitive functions of the Lisp system,
and user functions compiled into microcode.

	About the only useful thing to do with one of these objects
is to <!-- open: 41, close: 40 --><font class="italic">apply</font><!-- open: 41, close: 41 --> <!-- MATCHED MATCHED MATCHED --> it to arguments.  However, some functions are
provided for examining such objects, for user convenience.  See
<!-- open: 42, close: 41 --><font class="lisp">arglist</font><!-- open: 42, close: 42 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>arglist-fun)),
<!-- open: 43, close: 42 --><font class="lisp">args-info</font><!-- open: 43, close: 43 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>args-info-fun)),
<!-- open: 44, close: 43 --><font class="lisp">describe</font><!-- open: 44, close: 44 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>describe-fun)),
and <!-- open: 45, close: 44 --><font class="lisp">disassemble</font><!-- open: 45, close: 45 --> <!-- MATCHED MATCHED MATCHED --> (<font color='red'>LINK:(</font>disassemble-fun)).

	A <!-- open: 46, close: 45 --><font class="italic">locative</font><!-- open: 46, close: 46 --> <!-- MATCHED MATCHED MATCHED --> (see <a href='fd_loc.html#locative'>this link</a>) is a kind of a pointer to a single cell
anywhere in the system.  The contents of this cell can be accessed by
either <!-- open: 47, close: 46 --><font class="lisp">car</font><!-- open: 47, close: 47 --> <!-- MATCHED MATCHED MATCHED --> or <!-- open: 48, close: 47 --><font class="lisp">cdr</font><!-- open: 48, close: 48 --> <!-- MATCHED MATCHED MATCHED --> (both do the same thing for a locative)
(see <font color='red'>LINK:(</font>car-fun))
and updated by either <!-- open: 49, close: 48 --><font class="lisp">rplaca</font><!-- open: 49, close: 49 --> <!-- MATCHED MATCHED MATCHED --> or <!-- open: 50, close: 49 --><font class="lisp">rplacd</font><!-- open: 50, close: 50 --> <!-- MATCHED MATCHED MATCHED --> (see <font color='red'>LINK:(</font>rplaca-fun)).

	An <!-- open: 51, close: 50 --><font class="italic">array</font><!-- open: 51, close: 51 --> <!-- MATCHED MATCHED MATCHED --> (see <font color='red'>LINK:(</font>array))
is a set of cells indexed by a tuple of integer subscripts.
The contents of cells may be accessed and changed individually.  There are several
types of arrays.  Some have cells which may contain any object, while others (numeric
arrays) may only contain small positive numbers.  Strings are a type of array;
the elements are 8-bit positive numbers which encode characters.

<div class='section' id='2.2'>2.2 Lambda Lists</div><p class='cindent' id='lambda-list'><!-- lambda lists -->

	Note: the examples in this section are examples of lambda-lists,
not of Lisp forms!

	A <!-- open: 52, close: 51 --><font class="italic">lambda-expression</font><!-- open: 52, close: 52 --> <!-- MATCHED MATCHED MATCHED --> is the form of a user-defined function
in Lisp.  It looks like <!-- open: 53, close: 52 --><font class="lisp">(lambda <!-- open: 54, close: 52 --><font class="italic">lambda-list</font><!-- open: 54, close: 53 --> <u><font color='green'>SAIL</font></u>. <!-- open: 55, close: 53 --><font class="italic">body</font><!-- open: 55, close: 54 -->)</font><!-- open: 55, close: 55 --> <!-- MATCHED MATCHED MATCHED -->.  The
<!-- open: 56, close: 55 --><font class="italic">body</font><!-- open: 56, close: 56 --> <!-- MATCHED MATCHED MATCHED --> may be any number of forms.  In Maclisp and Lisp 1.5, the
<!-- open: 57, close: 56 --><font class="italic">lambda-list</font><!-- open: 57, close: 57 --> <!-- MATCHED MATCHED MATCHED --> (also called a <!-- open: 58, close: 57 --><font class="italic">bound-variable list</font><!-- open: 58, close: 58 --> <!-- MATCHED MATCHED MATCHED -->) is simply a
list of symbols (which act like <!-- open: 59, close: 58 --><font class="italic">formal parameters</font><!-- open: 59, close: 59 --> <!-- MATCHED MATCHED MATCHED --> in some other
languages).  When the lambda-expression is <!-- open: 60, close: 59 --><font class="italic">applied</font><!-- open: 60, close: 60 --> <!-- MATCHED MATCHED MATCHED --> to its
arguments (which act like <!-- open: 61, close: 60 --><font class="italic">actual parameters</font><!-- open: 61, close: 61 --> <!-- MATCHED MATCHED MATCHED --> in other languages),
the symbols are bound to the arguments, and the forms of the body
are evaluated sequentially; the result of the last of these evaluations
is returned.  If the number of arguments is not the same as the
length of the lambda-list, an error is generated. 

	In Lisp Machine Lisp the same simple lambda-lists may be used,
but there are additional features accessible via certain keywords (which start
with <!-- open: 62, close: 61 --><font class="lisp">&amp;</font><!-- open: 62, close: 62 --> <!-- MATCHED MATCHED MATCHED -->) and by using lists as elements of the lambda-list.

	The principle weakness of the simple scheme is that any
function must only take a certain, fixed number of arguments.  As we
know, many very useful functions, such as <!-- open: 63, close: 62 --><font class="lisp">list</font><!-- open: 63, close: 63 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 64, close: 63 --><font class="lisp">append</font><!-- open: 64, close: 64 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 65, close: 64 --><font class="lisp">+</font><!-- open: 65, close: 65 --> <!-- MATCHED MATCHED MATCHED -->,
and so on, may take a varying number of arguments.  Maclisp
solved this problem by the use of <!-- open: 66, close: 65 --><font class="italic">lexpr</font><!-- open: 66, close: 66 --> <!-- MATCHED MATCHED MATCHED -->s and <!-- open: 67, close: 66 --><font class="italic">lsubr</font><!-- open: 67, close: 67 --> <!-- MATCHED MATCHED MATCHED -->s, which
were somewhat inelegant since the parameters had to be referred to by
numbers instead of names (e.g. <!-- open: 68, close: 67 --><font class="lisp">(arg 3)</font><!-- open: 68, close: 68 --> <!-- MATCHED MATCHED MATCHED -->).  (For compatibility
reasons, Lisp Machine Lisp supports <!-- open: 69, close: 68 --><font class="italic">lexpr</font><!-- open: 69, close: 69 --> <!-- MATCHED MATCHED MATCHED -->s, but they should not be
used in new programs).

	In general, a function in Lisp Machine Lisp has zero or more
<!-- open: 70, close: 69 --><font class="italic">required</font><!-- open: 70, close: 70 --> <!-- MATCHED MATCHED MATCHED --> parameters, followed by zero or more <!-- open: 71, close: 70 --><font class="italic">optional</font><!-- open: 71, close: 71 --> <!-- MATCHED MATCHED MATCHED -->
parameters, followed by zero or one <!-- open: 72, close: 71 --><font class="italic">rest</font><!-- open: 72, close: 72 --> <!-- MATCHED MATCHED MATCHED --> parameter.
This means that the caller must provide enough arguments so that each
of the required parameters gets bound, but he may provide some extra
arguments for each of the optional parameters.  Also, if there is a
rest parameter, he can provide as many extra arguments as he wants,
and the rest parameter will be bound to a list of all these extras. 
Also, optional parameters may have a <!-- open: 73, close: 72 --><font class="italic">default-form</font><!-- open: 73, close: 73 --> <!-- MATCHED MATCHED MATCHED -->, which is a
form to be evaluated to produce the default argument if none is supplied.
	Here is the exact explanation of how this all works.  When
<!-- open: 74, close: 73 --><font class="lisp">apply</font><!-- open: 74, close: 74 --> <!-- MATCHED MATCHED MATCHED --> matches up the arguments with the parameters, it follows the
following algorithm: 
	The first required parameter is bound to the first
argument.  <!-- open: 75, close: 74 --><font class="lisp">apply</font><!-- open: 75, close: 75 --> <!-- MATCHED MATCHED MATCHED --> continues to bind successive required parameters
to the successive arguments.  If, during this process, there are no
arguments left but there are still some required parameters which have
not been bound yet, then an error is caused ("too few arguments").
	Next, after all required parameters are handled, <!-- open: 76, close: 75 --><font class="lisp">apply</font><!-- open: 76, close: 76 --> <!-- MATCHED MATCHED MATCHED -->
continues with the optional parameters, binding each argument to each
successive parameter.  If, during this process, there are no arguments
left, each remaining optional parameter's default-form is evaluated,
and the parameter is bound to it.  This is done one parameter at a time;
that is, first one default-form is evaluated, and then the parameter is
bound to it, then the next default-form is evaluated, and so on.
This allows the default for an argument to depend on the previous argument.
	Finally, if there is no rest parameter and there are no
remaining arguments, we are finished.  If there is no rest parameter
but there are still some arguments remaining, an error is caused ("too
many arguments").  But if there <!-- open: 77, close: 76 --><font class="italic">is</font><!-- open: 77, close: 77 --> <!-- MATCHED MATCHED MATCHED --> a rest parameter, it is bound
to a list of all of the remaining arguments.  (If there are no
remaining arguments, it gets bound to <!-- open: 78, close: 77 --><font class="lisp">nil</font><!-- open: 78, close: 78 --> <!-- MATCHED MATCHED MATCHED -->.)
	The way you express which parameters are required, optional,
and rest is by means of specially recognized symbols, which are called
<!-- open: 79, close: 78 --><font class="lisp">&amp;-<!-- open: 80, close: 78 --><font class="italic">keywords</font><!-- open: 80, close: 79 --></font><!-- open: 80, close: 80 --> <!-- MATCHED MATCHED MATCHED -->, in the lambda-list.  All such symbols' print names
begin with the character "<!-- open: 81, close: 80 --><font class="lisp">&amp;</font><!-- open: 81, close: 81 --> <!-- MATCHED MATCHED MATCHED -->".  A list of all such symbols is the value of
the symbol <!-- open: 82, close: 81 --><font class="lisp">lambda-list-keywords</font><!-- open: 82, close: 82 --> <!-- MATCHED MATCHED MATCHED -->. 
	The keywords used here are <!-- open: 83, close: 82 --><font class="lisp">&amp;optional</font><!-- open: 83, close: 83 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 84, close: 83 --><font class="lisp">&amp;rest</font><!-- open: 84, close: 84 --> <!-- MATCHED MATCHED MATCHED -->.
The way they are used is best explained by means of examples;
the following are typical lambda-lists, followed by descriptions
of which parameters are required, optional, and rest.
<table>
<tr valign='top'>
<td><font class='lisp'> (a b c)</font></td><td><!-- open: 85, close: 84 --><font class="lisp">a</font><!-- open: 85, close: 85 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 86, close: 85 --><font class="lisp">b</font><!-- open: 86, close: 86 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 87, close: 86 --><font class="lisp">c</font><!-- open: 87, close: 87 --> <!-- MATCHED MATCHED MATCHED --> are all required.  This function must be
passed three arguments.
</td></tr>
<tr valign='top'><td colspan='2'><font class='lisp'> (a b &amp;optional c)</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td><!-- open: 88, close: 87 --><font class="lisp">a</font><!-- open: 88, close: 88 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 89, close: 88 --><font class="lisp">b</font><!-- open: 89, close: 89 --> <!-- MATCHED MATCHED MATCHED --> are required, <!-- open: 90, close: 89 --><font class="lisp">c</font><!-- open: 90, close: 90 --> <!-- MATCHED MATCHED MATCHED --> is optional.  The function
may be passed either two or three arguments.
</td></tr>
<tr valign='top'><td colspan='2'><font class='lisp'> (&amp;optional a b c)</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td><!-- open: 91, close: 90 --><font class="lisp">a</font><!-- open: 91, close: 91 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 92, close: 91 --><font class="lisp">b</font><!-- open: 92, close: 92 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 93, close: 92 --><font class="lisp">c</font><!-- open: 93, close: 93 --> <!-- MATCHED MATCHED MATCHED --> are all optional.  The function may
be passed any number of arguments between zero and three, inclusively.
</td></tr>
<tr valign='top'>
<td><font class='lisp'> (&amp;rest a)</font></td><td><!-- open: 94, close: 93 --><font class="lisp">a</font><!-- open: 94, close: 94 --> <!-- MATCHED MATCHED MATCHED --> is a rest parameter.  The function may be passed any number of arguments.
</td></tr>
<tr valign='top'><td colspan='2'><font class='lisp'> (a b &amp;optional c d &amp;rest e)</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td><!-- open: 95, close: 94 --><font class="lisp">a</font><!-- open: 95, close: 95 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 96, close: 95 --><font class="lisp">b</font><!-- open: 96, close: 96 --> <!-- MATCHED MATCHED MATCHED --> are required, <!-- open: 97, close: 96 --><font class="lisp">c</font><!-- open: 97, close: 97 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 98, close: 97 --><font class="lisp">d</font><!-- open: 98, close: 98 --> <!-- MATCHED MATCHED MATCHED --> are optional,
and <!-- open: 99, close: 98 --><font class="lisp">e</font><!-- open: 99, close: 99 --> <!-- MATCHED MATCHED MATCHED --> is rest.  The function may be passed two or more arguments.
</td></tr><!-- item_ --></table><!-- end table -->

	In all of the cases above, the <!-- open: 100, close: 99 --><font class="italic">default-forms</font><!-- open: 100, close: 100 --> <!-- MATCHED MATCHED MATCHED --> for each parameter
were <!-- open: 101, close: 100 --><font class="lisp">nil</font><!-- open: 101, close: 101 --> <!-- MATCHED MATCHED MATCHED -->.  To specify your own default forms, instead
of putting a symbol as the element of a lambda-list, put in a list
whose first element is the symbol (the parameter itself) and 
whose second element is the default-form.  For example:
<table>
<tr valign='top'><td colspan='2'><font class='lisp'> (a &amp;optional (b 3))</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td>The default-form for <!-- open: 102, close: 101 --><font class="lisp">b</font><!-- open: 102, close: 102 --> <!-- MATCHED MATCHED MATCHED --> is <!-- open: 103, close: 102 --><font class="lisp">3</font><!-- open: 103, close: 103 --> <!-- MATCHED MATCHED MATCHED -->.  <!-- open: 104, close: 103 --><font class="lisp">a</font><!-- open: 104, close: 104 --> <!-- MATCHED MATCHED MATCHED --> is a required parameter, and
so it doesn't have a default form.
</td></tr>
<tr valign='top'><td colspan='2'><font class='lisp'> (&amp;optional (a 'foo) b (c (symeval a)) &amp;rest d)</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td><!-- open: 105, close: 104 --><font class="lisp">a</font><!-- open: 105, close: 105 --> <!-- MATCHED MATCHED MATCHED -->'s default-form is <!-- open: 106, close: 105 --><font class="lisp">'foo</font><!-- open: 106, close: 106 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 107, close: 106 --><font class="lisp">b</font><!-- open: 107, close: 107 --> <!-- MATCHED MATCHED MATCHED -->'s is <!-- open: 108, close: 107 --><font class="lisp">nil</font><!-- open: 108, close: 108 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 109, close: 108 --><font class="lisp">c</font><!-- open: 109, close: 109 --> <!-- MATCHED MATCHED MATCHED -->'s is
<!-- open: 110, close: 109 --><font class="lisp">(symeval a)</font><!-- open: 110, close: 110 --> <!-- MATCHED MATCHED MATCHED -->.  Note that if
the function whose lambda-list this is were called on no arguments,
<!-- open: 111, close: 110 --><font class="lisp">a</font><!-- open: 111, close: 111 --> <!-- MATCHED MATCHED MATCHED --> would be bound to the symbol <!-- open: 112, close: 111 --><font class="lisp">foo</font><!-- open: 112, close: 112 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 113, close: 112 --><font class="lisp">c</font><!-- open: 113, close: 113 --> <!-- MATCHED MATCHED MATCHED --> would be bound
to the binding of the symbol <!-- open: 114, close: 113 --><font class="lisp">foo</font><!-- open: 114, close: 114 --> <!-- MATCHED MATCHED MATCHED -->; this illustrates the fact
that each variable is bound immediately after its default-form is evaluated,
and so later default-forms may take advantage of earlier parameters
in the lambda-list.  <!-- open: 115, close: 114 --><font class="lisp">b</font><!-- open: 115, close: 115 --> <!-- MATCHED MATCHED MATCHED --> and <!-- open: 116, close: 115 --><font class="lisp">d</font><!-- open: 116, close: 116 --> <!-- MATCHED MATCHED MATCHED --> would be bound to <!-- open: 117, close: 116 --><font class="lisp">nil</font><!-- open: 117, close: 117 --> <!-- MATCHED MATCHED MATCHED -->.
</td></tr><!-- item_ --></table><!-- end table -->

	It is also possible to include, in the lambda-list, some other
symbols which are bound to the values of their default-forms upon
entry to the function.  These are <!-- open: 118, close: 117 --><font class="italic">not</font><!-- open: 118, close: 118 --> <!-- MATCHED MATCHED MATCHED --> parameters, and they are
never bound to arguments;  they are like "prog variables".
	To include such symbols, put them after any parameters, preceeded
by the <!-- open: 119, close: 118 --><font class="lisp">&amp;</font><!-- open: 119, close: 119 --> <!-- MATCHED MATCHED MATCHED -->-keyword <!-- open: 120, close: 119 --><font class="lisp">&amp;aux</font><!-- open: 120, close: 120 --> <!-- MATCHED MATCHED MATCHED -->.  Examples:
<table>
<tr valign='top'><td colspan='2'><font class='lisp'> (a &amp;optional b &amp;rest c &amp;aux d (e 5) (f (cons a e)))</font></td><td><!-- empty --></td></tr>
<tr><td><!-- empty title --></td><td><!-- open: 121, close: 120 --><font class="lisp">d</font><!-- open: 121, close: 121 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 122, close: 121 --><font class="lisp">e</font><!-- open: 122, close: 122 --> <!-- MATCHED MATCHED MATCHED -->, and <!-- open: 123, close: 122 --><font class="lisp">f</font><!-- open: 123, close: 123 --> <!-- MATCHED MATCHED MATCHED --> are bound, when the function is
called, to <!-- open: 124, close: 123 --><font class="lisp">nil</font><!-- open: 124, close: 124 --> <!-- MATCHED MATCHED MATCHED -->, <!-- open: 125, close: 124 --><font class="lisp">5</font><!-- open: 125, close: 125 --> <!-- MATCHED MATCHED MATCHED -->, and a cons of the first argument and 5.
</td></tr><!-- item_ --></table><!-- end table -->


	Note that aux-variables are bound sequentially rather than
in parallel.

	It is important to realize that the list of arguments to which
a rest-parameter is bound is set up in whatever way is most efficiently
implemented, rather than in the way that is most convenient for the
function receiving the arguments.  It is guaranteed neither to be a "real" list, nor to be
a temporary object which may be freely modified.  Sometimes the rest-args list
is stored in the function-calling stack, and loses its validity when the
function returns; if a rest-argument is to be returned or made part
of permanent list-structure, it must first be copied (see <!-- open: 126, close: 125 --><font class="lisp">append</font><!-- open: 126, close: 126 --> <!-- MATCHED MATCHED MATCHED -->).
The system will not detect the error of omitting to copy a rest-argument;
you will simply find that you have a value which seems to change behind your back.
	At other times the rest-args list will be an argument that was given to <!-- open: 127, close: 126 --><font class="lisp">apply</font><!-- open: 127, close: 127 --> <!-- MATCHED MATCHED MATCHED -->;
therefore it is not safe to <!-- open: 128, close: 127 --><font class="lisp">rplaca</font><!-- open: 128, close: 128 --> <!-- MATCHED MATCHED MATCHED --> this list as you may modify permanent
data structure.  An attempt to <!-- open: 129, close: 128 --><font class="lisp">rplacd</font><!-- open: 129, close: 129 --> <!-- MATCHED MATCHED MATCHED --> a rest-args list will be unsafe
in this case, while in the first case it would cause an error.

<!-- eof -->
</body>
</html>

